home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_olv_climbdebris.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  133 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_ClimbDebris.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message     startup
  13.     message     entered
  14.     message     timer
  15.     
  16.     thing       player          local
  17.     thing       rocks           local
  18.     thing       origin          local
  19.     
  20.     sector      tempSect        local
  21.     
  22.     surface     climbFace
  23.     
  24.     template    debris0=stnshrapas_nc_ns        local
  25.     template    debris1=stnshrapbs_nc_ns        local
  26.     
  27.     sound       sndFalling=gen_fallingrock_c.wav        local
  28.     
  29.     vector      RHPos           local
  30.     vector      LHPos           local
  31.     vector      RFPos           local
  32.     vector      LFPos           local
  33.     vector      rocksVel        local
  34.     vector      rocksRotVel     local
  35.     vector      rvec            local
  36.     
  37.     int         i=0             local
  38.     int         randNum         local
  39.     int         numDebris=2     local
  40.     int         sound1          local
  41.     
  42.     flex        rockvelocity        local
  43.  
  44. end
  45.  
  46. # ========================================================================================
  47.  
  48. code
  49.  
  50. startup:
  51.  
  52.     player = GetLocalPlayerThing();
  53.     return;
  54.  
  55. # ========================================================================================
  56.  
  57. entered:
  58.  
  59.     if(GetSenderRef() == climbFace)
  60.     {
  61.         SetTimer(RandBetween(2, 3));
  62.     }
  63.     
  64.     return;
  65.         
  66. # ========================================================================================
  67.  
  68. timer:
  69.  
  70.     randNum        = RandBetween(0, 3);    # Which appendage to drop a load from
  71.     numDebris    = RandBetween(1, 3);    # How many rocks to drop
  72.     origin        = GetThingPos(player);
  73.     tempSect    = GetThingSector(player);
  74.     
  75.     RVec = GetThingRVec(player);
  76.     RHPos = VectorSet(0.035 * VectorX(RVec), 0.035 * VectorY(RVec), 0.07);
  77.     LHPos = VectorSet(-0.035 * VectorX(RVec), -0.035 * VectorY(RVec), 0.07);
  78.     RFPos = VectorSet(0.03 * VectorX(RVec), 0.03 * VectorY(RVec), -0.08);
  79.     LFPos = VectorSet(-0.03 * VectorX(RVec), -0.03 * VectorY(RVec), -0.08);
  80.     
  81.     # if player is moving up, down, left or right -- generate debris
  82.     if((GetMoveStatus(player) >= 22) && (GetMoveStatus(player) <= 25))
  83.     {
  84.         PlaySoundLocal(sndFalling, 1.0, 0.0, 0x0, 0);
  85.         
  86.         # Drop a load!
  87.         for(i=0; i<numDebris; i=i+1)                                                                        
  88.         {
  89.             rocks = CreateThingAtPos(debris0[RandBetween(0, 1)], tempSect, VectorAdd(origin, RHPos[randNum]), '0 0 0');
  90.             Call rockVelocity;
  91.             Sleep(0.1);
  92.         }
  93.  
  94.         SetTimer(RandBetween(1, 3));
  95.     }
  96.     
  97.     # if player climbs over the top, generate some debris and stop the pulse
  98.     else if(GetMoveStatus(player) == 26)
  99.     {
  100.         PlaySoundLocal(sndFalling, 1.0, 0.0, 0x0, 0);
  101.  
  102.         # Just drop a load from the left foot
  103.         for(i=0; i<numDebris; i=i+1)                                                                        
  104.         {
  105.             rocks = CreateThingAtPos(debris0[RandBetween(0, 1)], tempSect, VectorAdd(origin, LFPos), '0 0 0');
  106.             Call rockVelocity;
  107.             Sleep(0.1);
  108.         }
  109.     }
  110.  
  111.     # if player is stopped, don't do anything except reset the timer to check again later
  112.     else if(GetMoveStatus(player) == 9) 
  113.     {
  114.         SetTimer(RandBetween(1, 3));
  115.     }
  116.     
  117.     return;
  118.         
  119. # ========================================================================================
  120.  
  121. rockVelocity:
  122.  
  123.     rocksVel = VectorSet(0, 0, 0.01);
  124.     rocksRotVel = VectorSet(0.0, 0.0, 360.0);
  125.     SetThingVel(rocks, VectorScale(rocksVel, 0.7));
  126.     SetThingRotVel(rocks, rocksRotVel);
  127.     return;
  128.         
  129. # ========================================================================================
  130.  
  131. end
  132.  
  133.